<?php
/*
 * marker-info.php
 */
?>

<div class="marker-info" id="marker-<?php echo $_POST['index']; ?>">
    <label>
        <span>Titre</span>
        <input type="text" name="title" id="marker-title" onkeyup="return editMarkerTitle(this.value, <?php echo $_POST['index']; ?>);" value="<?php echo $_POST['title']; ?>">
    </label>&nbsp;
    <label>
        <span title="Icone">Icone</span>
        <a href="#" id='marker-icon' class="icon-seletor" data-index="<?php echo $_POST['index']; ?>" title="Changer l'icone">
            <img src="<?php echo (isset($_POST['img'])) ? $_POST['img'] : 'image/marker-default.svg' ?>" height="32px" width="22px">
        </a>
    </label>
    <div class="marker-coordinates">
        <span>Coordonnées</span>&nbsp;&nbsp;
        <a href="#" onclick="$('#marker-coordinates-value-<?php echo $_POST['index']; ?>').toggle('normal'); return false;">Afficher / Cacher</a>
        <div id='marker-coordinates-value-<?php echo $_POST['index']; ?>' style="display: none;">
            <label>
                <span title="Latitute">Lat.</span>
                <input type="text" readonly="readonly" name="lat" id="marker-lat" value="<?php echo $_POST['lat']; ?>">
            </label>&nbsp;
            <label>
                <span title="Longitude">Long.</span>
                <input type="text" readonly="readonly" name="lat" id="marker-lng" value="<?php echo $_POST['lng']; ?>">
            </label>&nbsp;
        </div>
    </div>
</div>

<script type="text/javascript">
    $(function(){
        // Edition de l'icone
        $('#marker-<?php echo $_POST['index']; ?> #marker-icon').popover({
            html : true,
            placement : 'bottom',
            content : function(){
                var $ajax = $.ajax({
                    type: 'post',
                    url : 'marker-change-icon.php',
                    data: '&index=<?php echo $_POST['index']; ?>'
                });
                $ajax.done(function(data){
                    $('#marker-<?php echo $_POST['index']; ?> .popover-content').html(data);
                });
                return "Chargement en cours ...";
            }
        });
    });
</script>
